import {LocModel} from "../../../base/LocModel";
import {OrderId} from "../../../../../type/Type";
import {AttributeEnum, HurtType} from "../../../../dataSource/DataModel";

export let unitAdapter: { adapter: IUnitAdapter } = { adapter: undefined };


export interface IUnitAdapter {
    createHandle(owner: number, id: string, loc: LocModel, face: number): any
    setAcquireRange(handle: any, value: number): any
    getAcquireRange(handle: any): number
    setCanSleep(handle: any, flag: boolean): void
    getCanSleep(handle: any): boolean
    getCurrentOrder(handle: any): number
    getDefaultAcquireRange(handle: any): number
    getDefaultFlyHeight(handle: any): number
    getDefaultMoveSpeed(handle: any): number
    getDefaultPropWindow(handle: any): number
    getDefaultTurnSpeed(handle: any): number
    getExperience(handle: any): number
    setExperience(handle: any, newXpVal: number, showEyeCandy: boolean): void
    setFacing(handle: any, value: number): void
    getFacing(handle: any): number
    getIgnoreAlarmToggled(handle: any): boolean;
    getInventorySize(handle: any): number
    getLevel(handle: any): number
    setLevel(handle: any, value: number): void
    getName(handle: any): string
    setPaused(handle: any, flag: boolean): void
    getPaused(handle: any): boolean
    getLoc(handle: any): LocModel
    setLoc(handle: any, locModel: LocModel): void
    setPropWindow(handle: any, value: number): void
    getPropWindow(handle: any): number
    setShow(handle: any, flag: boolean): void
    getShow(handle: any): boolean
    getSleeping(handle: any): boolean
    setTurnSpeed(handle: any, value: number): void
    getTurnSpeed(handle: any): number
    getStrId(handle: any): string
    getLife(handle: any): number
    setLife(handle: any, value: number): void
    getMaxLife(handle: any): number
    setMaxLife(handle: any, value: number): void
    getLifePercent(handle: any): number
    setLifePercent(handle: any, value: number): void
    getMana(handle: any): number
    setMana(handle: any, value: number): void
    getMaxMana(handle: any): number
    setMaxMana(handle: any, value: number): void
    getManaPercent(handle: any): number
    setManaPercent(handle: any, value: number): void
    getAttackSpeed(handle: any): number
    getAttackSpeedInterval(handle: any): number
    setAttackSpeedInterval(handle: any, value: number): void
    setAttackSpeed(handle: any, value: number): void
    setMoveSpeed(handle: any, value: number): void
    getMoveSpeed(handle: any): number
    getAttackDistance(handle: any): number
    setAttackDistance(handle: any, value: number): void
    setModelPath(handle: any, path: string): void
    addAbility(handle: any, abilityId: number | string): boolean
    addSleepPerm(handle: any, add: boolean): void
    applyTimedLife(handle: any, buffId: number | string, duration: number): void
    canSleepPerm(handle: any): boolean
    decAbilityLevel(handle: any, abilCode: number): number
    hasAbility(handle: any, abilId: string): boolean
    getAbilityLevel(handle: any, abilCode: string): number
    getAgility(handle: any, includeBonuses: boolean): number
    getflyHeight(handle: any): number
    getIgnoreAlarm(handle: any, flag: boolean): boolean
    getIntelligence(handle: any, includeBonuses: boolean): number
    getStrength(handle: any, includeBonuses: boolean): number
    isHero(handle: any): boolean
    issueBuildOrder(handle: any, unit: string, loc: LocModel): boolean
    issueImmediateOrder(handle: any, order: string | OrderId): boolean
    issueOrderAt(handle: any, order: string | OrderId, loc: LocModel): boolean
    issueTargetOrder(handle: any, order: string | OrderId, targetWidget: any): boolean
    kill(handle: any): void
    pauseTimedLife(handle: any, flag: boolean): void
    recycleGuardPosition(handle: any): void
    removeAbility(handle: any, abilityId: number | string): boolean
    removeGuardPosition(handle: any): void
    resetCooldown(handle: any): void
    revive(handle: any, loc: LocModel, doEyecandy: boolean): boolean
    select(handle: any, flag: boolean): void
    setAbilityLevel(handle: any, abilCode: number | string, level: number): void
    setAgility(handle: any, value: number, permanent: boolean): void
    setAnimation(handle: any, whichAnimation: string): void
    setBlendTime(handle: any, timeScale: number): void
    setCreepGuard(handle: any, creepGuard: boolean): void
    setUnitIcon(handle: any, path: string): void
    setflyHeight(handle: any, value: number, rate: number): void
    setIntelligence(handle: any, value: number, permanent: boolean): void
    setPathing(handle: any, flag: boolean): void
    setScale(handle: any, scaleX: number, scaleY: number, scaleZ: number): void
    setStrength(handle: any, value: number, permanent: boolean): void
    setTimeScale(handle: any, timeScale: number): void
    setUseAltIcon(handle: any, flag: boolean): void
    setUseFood(handle: any, useFood: boolean): void
    setVertexColor(handle: any, red: number, green: number, blue: number, alpha: number): void
    wakeUp(handle: any): void
    setExtraAttr(handle: any, val: number,  targetAttr: AttributeEnum): void
    destroy(handle: any): void
    bindHandle(handle: any): void
    equal(handle1: any, handle2: any): boolean
    isVertigo(handle: any): boolean
    isValid(handle: any): boolean;
    damage(handle1: any, handle2: any, hurtValue: number, hurtType: HurtType): void;
    giveItem(handle1: any, handle2: any, index: number): boolean
    useAbility(handle: any, abilityId: string, targetLoc: LocModel, targetUnit: any): boolean;
    getOwnerId(handle: any): number;
}
